package com.lyhlmj.oop_client.Utils;

import java.awt.*;

public class PenUtil {
    public static Graphics2D setPen(Graphics g){
        //  设置画笔
        Graphics2D pen = (Graphics2D) g;
        //  平滑绘制（反锯齿）
        pen.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        Stroke stroke = new BasicStroke(2,  //  设置线宽
                BasicStroke.CAP_BUTT,
                BasicStroke.JOIN_ROUND,     //  圆角连接
                1,
                new float[]{20, 0},
                0
        );
        pen.setStroke(stroke);

        return pen;
    }
}
